<?php
  include_once("../sql_connect.php");
  include_once("../msg_redirect.php");
?>
<?php

/*取得，取消收藏的w_id*/
$w_id = $_POST[w_id];
$u_no = $_COOKIE['u_no'];

/*获得，删除数据的collection_id收藏编号*/
$collection_sql = mysql_query("select * from collection where u_no='$u_no' and w_id='$w_id'");
$collection_result = mysql_fetch_array($collection_sql);
$collection_id = $collection_result[collection_id];
if($collection_id){    		
	/*删除数据*/
	mysql_query("DELETE  FROM collection WHERE collection_id='$collection_id'  ");
	
	/*no数据大于$no自动减一*/
	mysql_query("UPDATE collection SET collection_id =collection_id -1 WHERE collection_id > '$collection_id'");
	echo true;
}
else echo false;
?> 